package WaiBao;

import java.util.Arrays;

public class JiangChnagChun {
    public static void main(String[] args) {
        String[] name = {"李豪杰(班长)", "张金毛(副班长)", "小李(学习委员)", "关喆(体育委员)", "葛厂长", "陈翔", "大金意", "王城", "王大大", "张胖龙", "郑楚燕", "李伯宁",
                "马生旭", "王逗逗", "李兜兜", "林口现", "小星", "董起舞", "小易", "小甫", "李小猪", "小白", "王大牛", "小婉", "大司马", "小颇", "小恬", "张家玮",
                "张海洋", "蒋长春(学生)"};//考生本人:蒋长春(学生)
        int[] age = {21, 18, 19, 20, 21, 20, 22, 21, 19,20, 18, 18, 18, 21, 21, 20, 18, 19, 18, 20, 19, 19, 20, 20, 20, 18, 20, 21, 20, 20};//考生年龄20


        double[] score1 = {72, 74, 81, 84, 76, 64, 71, 84, 80, 71, 74, 85, 85, 71, 74, 78, 64, 94, 92, 84, 73, 91, 75, 81, 78, 74, 88, 62, 67, 84};
        double[] score2 = {69, 75, 85, 87, 84, 68, 72, 74, 73, 81, 87, 78, 87, 75, 84, 64, 71, 74, 77, 68, 85, 62, 65, 84, 74, 87, 74, 75, 87, 93};
        double[] score3 = {79, 76, 75, 85, 78, 64, 70, 81, 84, 67, 63, 81, 85, 72, 68, 68, 84, 67, 66, 75, 92, 81, 91, 65, 79, 88, 74, 67, 71, 80};

        double qiuqiu1;//代表每个学生的总分
        double qiuqiu2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            qiuqiu1 = score1[i] +score2[i] +score3[i];
//            qiuqiu2 = ( qiuqiu1* 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + qiuqiu1);
//            System.out.println(name[i] + "的平均分为:" +qiuqiu2);
//        }

        double buluo1 = 0,buluo2 = 0;
        double[] pingzhi = new double[30];
//        for (int i = 0; i < 30; i++) {
//            buluo1 = score1[i] + score2[i] +score3[i];
//            buluo2 = (buluo1 * 1.0) / 3;
//            pingzhi[i] =buluo2;
//        }
//
//        for (int i = 0; i <pingzhi.length - 1; i++) {
//            for (int j = 0; j < pingzhi.length - i - 1; j++) {
//                if (pingzhi[j] < pingzhi[j + 1]) {
//                    double tep = pingzhi[j];
//                    pingzhi[j] = pingzhi[j + 1];
//                    pingzhi[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(pingzhi[i]);
//        }



        double huiduo1 = 0,huiduo2 = 0, huiduo3 = 0;//计算每门课的平均分
        double zaozao1 = 0,zaozao2 = 0,zaozao3 = 0;//计算每门课标准差
        double xishi1 = 0,xishi2 = 0,xishi3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i <score1.length; i++) {
            sum2+=score1[i];
        }
        huiduo1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+huiduo1);
        double Sum = 0;
        for (int i = 0; i <score2.length; i++) {
            Sum+=score2[i];
        }
        huiduo2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+huiduo2);
        double sum = 0;
        for (int i = 0; i <score3.length; i++) {
            sum+=score3[i];
        }
        huiduo3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+huiduo3);


////
        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <score1.length; i++) {
            c1+= (score1[i] -huiduo1)*(score1[i] -huiduo1);
        }
        zaozao1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+zaozao1);

        for (int i = 0; i <score2.length; i++) {
            c2+= (score2[i] -huiduo2)*(score2[i] - huiduo2);
        }
        zaozao2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+zaozao2);

        for (int i = 0; i <score3.length; i++) {
            c3+= (score3[i] -huiduo3)*(score3[i] -huiduo3);
        }
        zaozao3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+zaozao3);
//////////////////////
//////////////////////
        Arrays.sort(score1);
        Arrays.sort(score2);
        Arrays.sort(score3);
        xishi1 =(score1[14]+score1[15])*1.0/2;
        xishi2 =(score2[14]+score2[15])*1.0/2;
        xishi3 =(score3[14]+score3[15])*1.0/2;
        System.out.println("生物化学的中位数为:"+xishi1);
        System.out.println("微生物学的中位数为:"+xishi2);
        System.out.println("人体组织解剖学的中位数为:"+xishi3);



    }
}
